var prefix = ctx + "module/order"

$(function() {
	var columns = [{
            checkbox: true
        },
				{
			field : 'orderNum', 
			title : '订单号' 
		},
				/*{
			field : 'workFlowApply.taskId', 
			title : '任务号' 
		},*/
				{
			field : 'productInfo.fullName', 
			title : '产品' 
		},
				{
			field : 'typeName', 
			title : '订单类型' 
			
		},
				{
			field : 'auditType', 
			title : '审核类型' ,
			formatter: function(value, row, index) {
                if (value == 1) {
                	return '<span class="label label-success">成单审核</span>';
                } else if (value == 2) {
                	return '<span class="label label-danger">退单审核</span>';
                }else {
                	return '<span class="label label-danger">未知</span>';
                }
            }
		},
				{
			field : 'productInfo.productPrice', 
			title : '金额' 
		},
				{
			field : 'customerClue.customerName', 
			title : '客户' 
		},
				{
			field : 'salesUserName', 
			title : '业务员' 
		},		
				{
			field : 'updateTime', 
			title : '提交时间' 
		},
			{
			field : 'taskId', 
			title : '任务号' 
		},
		        {
            title: '操作',
            align: 'center',
            formatter: function(value, row, index) {
            	var actions = [];
				actions.push('<a class="btn btn-primary btn-sm ' + auditFlag + '" href="#" title="处理" mce_href="#" onclick="auditDetail(\'' + row.orderId +'\' , \'' + row.taskId +'\')"><i class="fa fa-hand-pointer-o"></i></a> ');
				return actions.join('');
            }
        }];
	var url = prefix + "/auditList";
	$.initTable(columns, url);
});

/*处理订单详情*/
function auditDetail(orderId,taskId) {
    var url = prefix + '/auditDetail/' + orderId+'/'+taskId;
    layer_showAuto("处理订单详情", url);
}


